﻿using System;
using UnityEngine;

namespace CGF
{
    public class ColliderListener : MonoBehaviour
    {
        public Action<Collider> onTriggerEnter, onTriggerStay, onTriggerExit;
        public Action<Collider2D> onTriggerEnter2D, onTriggerStay2D, onTriggerExit2D;
        public Action<Collision> onCollisionEnter, onCollisionStay, onCollisionExit;
        public Action<Collision2D> onCollisionEnter2D, onCollisionStay2D, onCollisionExit2D;

        private void OnTriggerEnter(Collider other)
        {
            onTriggerEnter?.Invoke(other);
        }

        private void OnTriggerStay(Collider other)
        {
            onTriggerStay?.Invoke(other);
        }

        private void OnTriggerExit(Collider other)
        {
            onTriggerExit?.Invoke(other);
        }

        private void OnTriggerEnter2D(Collider2D collision)
        {
            onTriggerEnter2D?.Invoke(collision);
        }

        private void OnTriggerStay2D(Collider2D collision)
        {
            onTriggerStay2D?.Invoke(collision);
        }

        private void OnTriggerExit2D(Collider2D collision)
        {
            onTriggerExit2D?.Invoke(collision);
        }

        private void OnCollisionEnter(Collision collision)
        {
            onCollisionEnter?.Invoke(collision);
        }

        private void OnCollisionStay(Collision collision)
        {
            onCollisionStay?.Invoke(collision);
        }

        private void OnCollisionExit(Collision collision)
        {
            onCollisionExit?.Invoke(collision);
        }

        private void OnCollisionEnter2D(Collision2D collision)
        {
            onCollisionEnter2D?.Invoke(collision);
        }

        private void OnCollisionStay2D(Collision2D collision)
        {
            onCollisionStay2D?.Invoke(collision);
        }

        private void OnCollisionExit2D(Collision2D collision)
        {
            onCollisionExit2D?.Invoke(collision);
        }

    }
}
